﻿using System;
using System.IO;

namespace StartUp
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "publish\\SubstrateHelper.exe");
            string workingDir = Path.Combine(Directory.GetCurrentDirectory(), "publish");
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(path);
            psi.RedirectStandardOutput = true;
            psi.WorkingDirectory = workingDir;
            psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            psi.UseShellExecute = false;
            System.Diagnostics.Process listFiles;
            listFiles = System.Diagnostics.Process.Start(psi);
            System.IO.StreamReader myOutput = listFiles.StandardOutput;
            listFiles.WaitForExit(-1);
            if (listFiles.HasExited)
            {
                string output = myOutput.ReadToEnd();                
            }

        }
    }
}
